<?php
namespace Admin\Controller;
use Common\Controller\BackendController;
class AdminRoleController extends BackendController{
  public function _initialize(){
      parent::_initialize();
      $this->_mod=D('AdminRole');
  }
  public  function _before_edit(){
      $this->assign('mark','index');
  }
  public function auth(){
      $auth_mod=D('AdminAuth');
      if(IS_POST){
        $id=I('post.id',0,'intval');
        $group_id=I('post.group_id');
        $group_msid=I('post.group_msid');
        
      }else{
          $id=I('get.id',0,'intval');
          !$id &&　$this->error("请选择管理员角色");
          $role=M('admin_role')->field('id,name,groups,mids')->where(array('id'=>$id))->find();
          !$role && $this->error('管理员不存在');
          $role['groups']=explode(',', $role['groups']);
          $role['mids']=explode(',', $role['mids']);
          if(false=== $auth_group=F('auth_group'))  $auth_group=D("AdminAuthGroup")->auth_group_cache();
          if(false===F('menu_list')) $menus=D('Menu')->menu_cache();
          $this->assign('role',$role);
          $this->assign('menus',$menus['parent']);
          $this->assign('auth_group',$auth_group);
          $this->display();  
      }
  }
}